package com.desksoft.ecommerce.util.html.element.variable;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 系统变量
 * $Sys{...}这种形式获取
 * @author Administrator
 *
 */
public class SystemVariable extends Variable {

	public static final String key_date = "date";	//	服务器当前日期
	public static final String key_time = "time";	//	服务器当前时间
	
	protected static final SimpleDateFormat fmt_ymd = new SimpleDateFormat("yyyy-MM-dd");
	protected static final SimpleDateFormat fmt_ymdhms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	public SystemVariable(){
		super();
		this.type = "Sys";
		initVariable();
	}

	@Override
	public void initVariable() {
		Date now = new Date();
		this.map.put(key_date, fmt_ymd.format(now));
		this.map.put(key_time, fmt_ymdhms.format(now));
	}

	@Override
	public String getType() {
		return this.type;
	}
	
	
}
